package gui.splash;

import java.awt.CardLayout;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;

/**
 *
 * @author Victor
 */
@SuppressWarnings("serial")
public class Splash extends javax.swing.JFrame {

	private String imagen1="src/gui/splash/resources/splash1.png";
	private String imagen2="src/gui/splash/resources/splash2.png";
	private String imagen3="src/gui/splash/resources/splash3.png";
	private String imagen4="src/gui/splash/resources/splash4.png";
	
	public static Splash _instancia=null;
	
	public static Splash getInstancia(){
		if(_instancia==null){
			_instancia=new Splash();
		}
		return _instancia;
	}
	
    /** Creates new form Splash */
    public Splash() {
    	super("Recomendador UCM");
        initComponents();
        setLocationRelativeTo(null);
        setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    private void initComponents() {

        jPanel10 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setAlwaysOnTop(true);
        setName("Form"); // NOI18N
        setResizable(false);
        setUndecorated(true);
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setLayout(new java.awt.CardLayout());

        jPanel1.setMaximumSize(new java.awt.Dimension(400, 300));
        jPanel1.setMinimumSize(new java.awt.Dimension(400, 300));
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(400, 300));
        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel1.setIcon((new ImageIcon(imagen1)));
        jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel1.add(jLabel1);

        jPanel10.add(jPanel1, "card1");

        jPanel2.setMaximumSize(new java.awt.Dimension(400, 300));
        jPanel2.setMinimumSize(new java.awt.Dimension(400, 300));
        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.LINE_AXIS));

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel2.setIcon((new ImageIcon(imagen2)));
        jLabel2.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel2.setName("jLabel2"); // NOI18N
        jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel2.add(jLabel2);

        jPanel10.add(jPanel2, "card2");

        jPanel3.setMaximumSize(new java.awt.Dimension(400, 300));
        jPanel3.setMinimumSize(new java.awt.Dimension(400, 300));
        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.LINE_AXIS));

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel3.setIcon((new ImageIcon(imagen3)));
        jLabel3.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel3.setName("jLabel3"); // NOI18N
        jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel3.add(jLabel3);

        jPanel10.add(jPanel3, "card3");

        jPanel4.setMaximumSize(new java.awt.Dimension(400, 300));
        jPanel4.setMinimumSize(new java.awt.Dimension(400, 300));
        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.LINE_AXIS));

        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel4.setIcon((new ImageIcon(imagen4)));
        jLabel4.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jLabel4.setName("jLabel4"); // NOI18N
        jLabel4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jPanel4.add(jLabel4);

        jPanel10.add(jPanel4, "card4");


        getContentPane().add(jPanel10);

        pack();
    }// </editor-fold>

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Splash().setVisible(true);
            }
        });
    }

    public void avanza(){

        splash++;
        CardLayout cl = (CardLayout)(jPanel10.getLayout());
       
        cl.show(jPanel10, "card"+splash);

    }

    public class FondoPanel extends javax.swing.JPanel {
     private Image imgFondo;

     public FondoPanel() {
        preInit();
        initComponents();
     }

        @SuppressWarnings("unused")
                private FondoPanel(String string) {
            imgFondo = (new ImageIcon(getClass().getResource("./resources/splash1.png"))).getImage();
        }

     private void initComponents() {
     }

     private void preInit(){

         imgFondo = (new ImageIcon(getClass().getResource("./resources/splash1.png"))).getImage();

     }

     protected void paintComponent(Graphics g) {

        g.drawImage(imgFondo,0,0,null);

     }

     void pintarImagen(String imagen){

         
         imgFondo = (new ImageIcon(getClass().getResource("./resources/splash2.png"))).getImage();
         /*repaint();
         paintComponent(this.getGraphics());*/
     }

    }

    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    // End of variables declaration
    private int splash = 1;
}

